package com.fanbai.score.manage.fragment;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.fanbai.score.R;
import com.fanbai.score.common.base.BaseFragment;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by acer on 2017/5/30.
 */

public class ActListFragment extends BaseFragment{

    @BindView(R.id.view_recyclerView)
    RecyclerView mRecyclerView;
    /**
     * The fragment argument representing the section number for this
     * fragment.
     */
    private static final String ARG_SECTION_NUMBER = "section_number";
    /**
     * Returns a new instance of this fragment for the given section
     * number.
     */
    public static ActListFragment newInstance(int sectionNumber) {
        ActListFragment fragment = new ActListFragment();
        Bundle args = new Bundle();
        args.putInt(ARG_SECTION_NUMBER, sectionNumber);
        fragment.setArguments(args);
        return fragment;
    }

    public ActListFragment() {
    }
    @Override
    protected int getLayoutID() {
        return R.layout.manage_fragment_actlist;
    }

    @Override
    public String getTitleName() {
        return "活动列表";
    }

    @Override
    public void iniTitleLeft(ImageView tv) {

    }

    @Override
    public void iniTitleRight(TextView tv) {
        tv.setText("新增");
        tv.setVisibility(View.VISIBLE);
    }

    @Override
    protected void initView(View view) {

    }

    @Override
    protected void initData() {
        List<String> dataList = new ArrayList<>();
        dataList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1494156320411&di=ee09c92ad8fa24ca4fe0efb54d902133&imgtype=0&src=http%3A%2F%2Fimg.newmotor.com.cn%2FUploadFiles%2Fimage%2F20160506%2F20160506114832563256.png");
        dataList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b10000_10000&sec=1494146013&di=8cdae46fd79675fb1e22e24572d7f578&src=http://www.moto2s.com/ziliao/59/2012102014411842848.jpg");
        dataList.add("https://timgsa.baidu.com/timg?image&quality=80&size=b10000_10000&sec=1494146013&di=8cdae46fd79675fb1e22e24572d7f578&src=http://www.moto2s.com/ziliao/59/2012102014411842848.jpg");
        mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
        mRecyclerView.setAdapter(new CommonAdapter<String>(ctx, R.layout.business_item_actlist,
                dataList){
            @Override
            protected void convert(ViewHolder holder, String s, int position) {
                holder.setText(R.id.businessItemActList_actName, ""+s);
            }
        });
    }

    @Override
    protected void initListener() {

    }
}
